package com.ruoyi.finance.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.security.annotation.PreAuthorize;
import com.ruoyi.finance.domain.TJrProduct;
import com.ruoyi.finance.service.financeService;
import com.ruoyi.system.api.RemoteFileService;
import com.ruoyi.system.api.domain.SysFile;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * @return name
 */
@RestController
@RequestMapping("product")
public class financeController {
    @Autowired
    private financeService service;
    @Autowired
    private RemoteFileService remoteFileService;

    @PostMapping("upload")
    public Object upload(MultipartFile file){
     System.out.println("进不进"+file.getOriginalFilename());
        /*      R<SysFile> upload = remoteFileService.upload(file);*/
        return remoteFileService.upload(file).getData();


    }
    @PreAuthorize(hasPermi = "finance:product:list")
    @RequestMapping("list")
    public List<TJrProduct> listAll(){
        List<TJrProduct> tJrProducts = service.listAll();
        return tJrProducts;
    }

    @PreAuthorize(hasPermi = "finance:product:list")
    @RequestMapping("list2")
    public List<TJrProduct> listAll2(){
        List<TJrProduct> tJrProducts = service.listAll2();
        return tJrProducts;
    }

    @PreAuthorize(hasPermi = "finance:product:list")
    @RequestMapping("list3")
    public List<TJrProduct> listAll3(){
        List<TJrProduct> tJrProducts = service.listAll3();
        return tJrProducts;
    }

    @PreAuthorize(hasPermi = "finance:product:add")
    @RequestMapping("addinstall")
    public boolean addinstall(@RequestBody TJrProduct tJrProduct){
        boolean b = service.addinstall(tJrProduct);
        return b;
    }

    @PreAuthorize(hasPermi = "finance:product:update")
    @RequestMapping("updatedeflg")
    public boolean updatedeflg(String id){
        boolean b = service.updatedeflg(id);
        return b;
    }


    @PreAuthorize(hasPermi = "finance:product:list")
    @RequestMapping("FactoringProduct")
    public List<TJrProduct> FactoringProduct(String id){
        List<TJrProduct> products = service.FactoringProduct(id);
        return products;
    }




}
